<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__ADMIN__/css/pintuer.css">
    <link rel="stylesheet" href="__ADMIN__/css/admin.css">
    <script src="__ADMIN__/js/jquery.js"></script>
    <script src="__ADMIN__/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">导航信息列表</strong></div>
    <div class="padding border-bottom">
        <a class="button border-main" href="{:url('admin/menu/add')}"><span class="icon-plus-square-o"></span> 添加菜单</a>
    </div>
    <table class="table table-hover text-center">
        <tr>
            <th width="5%">菜单ID</th>
            <th>菜单名称</th>
            <th>菜单状态</th>
            <th>菜单级别</th>
           
            <th width="250">操作</th>
        </tr>
        {volist name="menus" id="v"}
            <tr>
                <td>{$v.menu_id}</td>
                <td>{$v.menu_name}</td>
                <td>{$v.is_show}</td>
                <td>{if condition="$v.level eq 1"}一级菜单{else /}二级菜单{/if}</td>
                <td>
                    <div class="button-group">
                        <a type="button" class="button border-main" href="{:url('admin/menu/edi',['id'=>$v.menu_id,'status'=>1])}"><span class="icon-edit"></span>修改</a>
                        <a class="button border-red"  onclick="return del({$v.menu_id},1)"><span class="icon-trash-o"></span> 删除</a>
                    </div>
                </td>
            </tr>
            {volist name="$v.two" id="vos"}
                <tr>
                <td>{$vos.id}</td>
                <td>{$vos.two_menu}</td>
                <td>{$vos.is_show}</td>
                <td>{if condition="$vos.level eq 1"}一级菜单{else /}二级菜单{/if}</td>
                <td>
                    <div class="button-group">
                        <a type="button" class="button border-main" href="{:url('admin/menu/edi',['id'=>$vos.id,'status'=>2])}"><span class="icon-edit"></span>修改</a>
                        <a class="button border-red"  onclick="return del({$vos.id},2)"><span class="icon-trash-o"></span> 删除</a>
                    </div>
                </td>
            </tr>
            {/volist}
      {/volist}
        <tr>
            <td colspan="8">
               
            </td>
        </tr>
    </table>

</div>
<script>
    function del(id,status){
        if(confirm("您确定要删除吗?")){
            $.ajax({
                type : "POST",
                url : "{:url('admin/menu/del')}",
                data : {'id':id,'status':status},
                dataType :'json',
                success:function (data) {
                    
                    alert(data);
                    location.reload(true);
                },
                error:function (data) {
                    console.log('error');
                },
            })
        }else{
            return false;
        }
    }
</script>
</body></html>